//标签对应的ID
var lable =null;
//总页数
var totalPage;
//总数据的条数
var totalCount;
//每页显示的条数
var pageSize;
//当前页面
var pageIndex=$(".totalPage").attr("pageIndex");
//通过标签查找歌单
$(document).ready(function () {
    $(".js_tag").click(function () {
        lable = $(this).attr("data-id");
       // alert(lable);
        window.window.location.href="playlistServlet?lable="+lable;

    })
    $("#hot").click(function () {
        var hot=$(this).attr("hot");
        window.window.location.href="playlistServlet?hot="+hot;
    })
    /*$(".js_tag").click(function () {
        var lable = $("this").attr("data-id");
        alert(lable);
        //window.window.location.href="playlistServlet?pageIndex="+num;
    })*/
})

$(document).ready(function () {
    //首页pageIndex  初始定义==1
    /*pageIndex = 1;
    totalPage = $("#totalPage").attr("value");
    pageIndex = $("#totalPage").attr("pageIndex");
    totalCount = $("#totalPage").attr("totalCount");*/
    $("#homePage").click(function () {
        //alert("首页");
        pageIndex = $(".totalPage").attr("pageIndex");
        $.ajax({
            "url"      :"CsxPageServlet",
            "data"     :{"pageIndex":pageIndex,"lable":lable},
            "type"     :"GET",
            "dataType" :"JSON",
            "success"  : function (data) {
                alert(data);
            }
        })
    })

    $("#upPage").click(function () {
        alert("上一页")
        if(pageIndex=1){
            return false;
        }else{
            pageIndex--;
            $.ajax({
                "url"      :"CsxPageServlet",
                "data"     :{"pageIndex":pageIndex,"lable":lable},
                "type"     :"GET",
                "dataType" :"JSON",
                "success"  : function (data) {
                    alert(data);
                }
            })
        }
    })

    $("#downPage").click(function () {
        alert(pageIndex)
        if(pageIndex=totalPage){
            return false;
        }else{
            pageIndex++;
            pageIndex = $(".totalPage").attr("pageIndex");
            $.ajax({
                "url"      :"CsxPageServlet",
                "data"     :{"pageIndex":pageIndex,"lable":lable},
                "type"     :"GET",
                "dataType" :"JSON",
                "success"  : function (data) {

                }
            })
        }
    })

    $("#endPage").click(function () {
        alert("尾页")
        pageIndex=totalPage;
        $.ajax({
            "url"      :"CsxPageServlet",
            "data"     :{"pageIndex":pageIndex,"lable":lable},
            "type"     :"GET",
            "dataType" :"JSON",
            "success"  : function (data) {
                alert(data);
            }
        })
    })
})



